package com.miaoxie.web.controller;

import com.miaoxie.service.crawl.INewsCrawlDatumService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: miaoxie
 * Date: 2018-05-16
 * Time: 上午11:18
 */
@RestController
@RequestMapping(value = "/crawlController")
public class CrawlController extends ResponseMessageController {

    @Autowired
    INewsCrawlDatumService newsCrawlDatumService;

    @ApiOperation(value="test-index", notes="")
    @RequestMapping(value = "/findAll")
    public Map<String, Object> index(){
        this.getMap().put("result",newsCrawlDatumService.findAll());
        return returnSuccess();
    }


    @ApiOperation(value="test-index", notes="")
    @RequestMapping(value = "/findPage")
    public Map<String, Object> index(Integer page,Integer size,String clom,String sortType){
        this.getMap().put("result",newsCrawlDatumService.findPage(page,size,clom,sortType));
        System.out.println("");
        return returnSuccess();
    }
}
